package com.cap.dreamcircle.Model.Impl;

import com.cap.dreamcircle.Api.Message;
import com.cap.dreamcircle.Model.Bean.NotifyBean;
import com.cap.dreamcircle.Model.Bean.SystemMessageBean;
import com.cap.dreamcircle.Model.Bean.UnReadMsgBean;
import com.cap.dreamcircle.Model.IMessageModel;
import com.cap.dreamcircle.Utils.ServiceFactory;
import com.cap.dreamcircle.Utils.TransformUtils;

import java.util.HashMap;

import rx.Observable;

/**
 * Created by liucxu on 2018/3/21.
 */

public class MessageModelImpl implements IMessageModel {
    @Override
    public Observable<NotifyBean> RequestNotifyMessage(int pageNum) {
        HashMap<String,String> params=new HashMap<>();
        params.put("task","queryMsgList");
        params.put("pageNum",pageNum+"");
        return ServiceFactory.GetInstance().createService(Message.class).RequestNotifyMessage(params).compose(TransformUtils.<NotifyBean>defaultSchedulers());
    }

    @Override
    public Observable<SystemMessageBean> RequestSystemMessage(int pageNum) {
        HashMap<String,String> params=new HashMap<>();
        params.put("task","querySysMsgList");
        params.put("pageNum",pageNum+"");
        return ServiceFactory.GetInstance().createService(Message.class).RequestSystemMessage(params).compose(TransformUtils.<SystemMessageBean>defaultSchedulers());
    }

    @Override
    public Observable<UnReadMsgBean> RequestMessageCount() {
        HashMap<String,String> params=new HashMap<>();
        params.put("task","queryMsgCount");
        return ServiceFactory.GetInstance().createService(Message.class).RequestMessageCount(params).compose(TransformUtils.<UnReadMsgBean>defaultSchedulers());
    }
}
